package com.hyz.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hyz.dao.AgencyDao;
import com.hyz.pojo.Agency;
import com.hyz.service.AgencyService;
import org.springframework.stereotype.Service;

@Service
public class AgencyServiceImpl extends ServiceImpl<AgencyDao, Agency>implements AgencyService {
    @Override
    public IPage<Agency> getByPage(Integer page, Integer pageSize, String name) {
        IPage<Agency> iPage = new Page<>(page,pageSize);
        LambdaQueryWrapper<Agency> qwq = new LambdaQueryWrapper<>();
        qwq.eq(name!=null,Agency::getName,name);
        IPage<Agency> page1 = page(iPage, qwq);
        return page1;
    }
}
